local shilu = fk.CreateSkill({
    name = "sj6__shilu",
})

Fk:loadTranslationTable{
    ["sj6__shilu"] = "嗜戮",
    [":sj6__shilu"] = " 一名角色的回合开始时，你可以令其受到1点伤害并摸三张牌。若其因此死亡，此后游戏经过该角色的座次时，你摸一张牌。",

    ["@@sj6__shilu"] = "嗜戮",
    ["#sj6__shilu"] = "嗜戮：你可以令%dest受到1点伤害并摸三张牌",
    
    ["$sj6__shilu1"] = "既得一世之富贵，管甚国家洪水滔天？",
    ["$sj6__shilu2"] = "江东六十四郡，我欲取之，谁不予之？",
  
}

shilu:addEffect(fk.TurnStart, {
    anim_type = "control",
    can_trigger = function(self, event, target ,player, data)
      return player:hasSkill(shilu.name)
    end,
    on_cost = function (self, event, target, player, data)
      return player.room:askToSkillInvoke(player,{
        skill_name = shilu.name,
        prompt = "#sj6__shilu::"..target.id
      })
    end,
    on_use = function(self, event, target, player, data)
      player.room:damage{from = player,to = target, damage = 1, skillName = shilu.name}
      if not target.dead then
        target:drawCards(3,shilu.name)
      end
    end,
})

shilu:addEffect(fk.Death, {
  can_refresh = function(self, event, target, player, data)
    return player:hasSkill(shilu.name) and data.damage.from and data.damage.from == player and data.damage.skillName and data.damage.skillName == shilu.name
  end,
  on_refresh = function(self, event, target, player, data)
    player.room:addTableMarkIfNeed(player,"sj6__shilu",target.id)
    --[[ 设置后标记会被清除
    player.room:setPlayerMark(target,"@@sj6__shilu",1)
    print(target:getMark("@@sj6__shilu"))
    --]]
  end,
})

shilu:addEffect(fk.EventTurnChanging, {
  can_refresh = function(self, event, target, player, data)
    return player:hasSkill(shilu.name) and target.dead and 
    (
      --target:getMark("@@sj6__shilu") > 0 or 
      table.contains(player:getTableMark("sj6__shilu"),target.id)
    )
  end,
  on_refresh = function(self, event, target, player, data)
    player:broadcastSkillInvoke(shilu.name)
    player.room:notifySkillInvoked(player, shilu.name,"drawcard")
    player:drawCards(1,shilu.name)
  end,
})

return shilu